package com.wx.cloud.code.controller;

import com.wx.cloud.code.common.CommonResult;
import com.wx.cloud.code.model.CodeTable;
import com.wx.cloud.code.service.CodeTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;

@RestController
@RequestMapping("/codeTable")
public class CodeTableController {
    @Autowired
    private CodeTableService codeTableService;

    @GetMapping("/getCodeByType")
    public CommonResult getCodeByType(@RequestParam String type){
        HashMap<String, Object> data = new HashMap<>();
        List<CodeTable> codeTables = codeTableService.getCodeByType(type);
        data.put("data", codeTables);
        return CommonResult.success(data);
    }
}
